// ----------------------------------
// RSDK Project: Sonic Essence
// Script Description: Windmill Parallax Sprite
// Script Author: Tails LP
// ----------------------------------

//-------Aliases-------//

//-------Function declarations-------//

//-------Static Values-------//

//-------Tables-------//


//-------Functions-------//


event ObjectMain
	if object.state == 0
		object.rotation = object.value0
		object.state ++
	else
		object.rotation ++
	endif
	object.drawOrder = 2
	object.priority = PRIORITY_ACTIVE
end event

event ObjectDraw
	//temp0 = object.ixpos
	//temp0 += hParallax[3].scrollPos
	//temp1 = object.ypos
	//DrawSpriteFX(0, FX_ROTATE, temp0, temp1)

		temp0 = screen.xoffset
		temp0 *= 6
		temp0 >>= 6
		temp0 &= 511
		FlipSign(temp0)
		temp0 += object.value2
		temp1 = screen.yoffset
		temp1 >>= 2
		temp1 &= 1023
		FlipSign(temp1)
		temp0 += object.ixpos
		temp1 += object.iypos
		temp1 += 20
		DrawSpriteScreenFX(object.propertyValue, FX_ROTATE, temp0, temp1)
		temp0 += 512
		DrawSpriteScreenFX(object.propertyValue, FX_ROTATE, temp0, temp1)
end event

event ObjectStartup
    	LoadSpriteSheet("WIZ/ParallaxSprite.gif")
	SpriteFrame(-22, -22, 45, 45, 1, 1)
	SpriteFrame(-17, -17, 35, 35, 47, 1)
	SpriteFrame(-12, -12, 25, 25, 83, 1)	
	object.value2 = 496

	
	temp0 = screen.xcenter
	temp0 >>= 2
	object.value2 -= temp0	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 223, 172)
end event